Loop_Practise_Que_06

Home / Java Practice Question / Loop_Practise_Que_06

Loop_Practise_Que_06


WAP to check an given number is palindrome or not.....

Program : - 


public class Basics{

     public static boolean ispalindrome(int num)

  {

    int ans=0;

for(int i=num;i>0;i=i/10){
int digit = i%10;
ans=(ans*10)+ digit;
}

if (ans==num){
return true;
}else{
return false;
}
}
}